#ifndef PLAYER_H
#define PLAYER_H

#include <QObject>
#include "cards.h"

class Player : public QObject
{
    Q_OBJECT
public:
    //角色
    enum Role
    {
        Lord,
        Farmer
    };

    //性别
    enum Sex
    {
        Man,
        Woman
    };

    //方向
    enum Direction
    {
        Left,
        Right
    };

    //类型
    enum Type
    {
        Robot,
        User,
        UnKnow
    };


    explicit Player(QObject *parent = nullptr);
    Player(const QString& name, QObject* parent = nullptr);

    //名字
    void Set_Name(const QString& name);
    const QString& Get_Name()const;

    //角色
    void Set_Role(Role role);
    Role Get_Role()const;

    //性别
    void Set_Sex(Sex sex);
    Sex Get_Sex()const;

    //方位
    void Set_Direction(Direction direction);
    Direction Get_Direction()const;

    //玩家类型
    void Set_Type(Type type);
    Type Get_Type()const;

    //玩家的分数
    void Set_Score(int score);
    int Get_Score()const;

    //游戏结果
    void Set_Is_Win(bool flag);
    bool Get_Is_Win()const;

    //提供当前对象的上家/下家对象
    void Set_Prev_Player(Player* player);
    void Set_Next_Player(Player* Player);
    Player* Get_Prev_Player();
    Player* Get_Next_Player();

    //抢地主
    void Grad_Lord_Bet(int point);

    //存储扑克牌
    void Store_Dispatch_Card(const Card& card);
    void Store_Dispatch_Cards(const Cards& cards);

    //得到所有的牌
    const Cards& Get_Cards()const;

    //清空玩家所有的牌
    void Clear_Cards();

    //出牌
    void Plared_Hand(const Cards& cards);

    //设置出牌玩家待处理的扑克牌
    void Set_Pending_Info(Player* player,Cards& cards);
    Player* Get_Pend_Player();
    const Cards& Get_Pend_Cards()const;

    //准备抢地主
    virtual void PrePare_Call_Lord();
    //准备出牌
    virtual void PrePare_Play_Hand();

signals:

protected:
    QString name_;
    Role role_;
    Sex sex_;
    Direction direction_;
    Type type_;
    int score_;
    bool is_win_;

    Player* prev_;//上家
    Player* next_;//下家

    Cards cards_;//玩家手里的牌
    Cards pend_cards_;//打出去的牌
    Player* pend_player_;//打出者
};

#endif // PLAYER_H
